import request from '@/utils/request'

/**
 * 查询企业的部门列表
 * @returns
 */

export const reqGetDepartments = () => request({
  url: '/company/department'
})

/**
 * 根据id删除部门
 * @param {*} id  部门id
 * @returns
 */

export const reqDelDepartments = (id) => request({
  url: `/company/department/${id}`,
  method: 'delete'
})

/**
 * 新增部门列表
 * @param {*} data
 * @returns
 */
export const reqAddDepartments = (data) => {
  return request({
    method: 'post',
    url: '/company/department',
    data
  })
}

/**
 * 根据id查询部门详情
 * @param {*} id
 * @returns
 */
export const reqGetDepartDetail = (id) => request({
  method: 'get',
  url: `/company/department/${id}`
})

/**
 * 根据id修改部门详情
 * @param {*} data 修改部门数据
 * @returns
 */
export const reqUpdateDepartments = (data) => {
  return request({
    method: 'put',
    url: `/company/department/${data.id}`,
    data
  })
}
